<?php 
	error_reporting(0);
	
	define("DEBUG", true);
	
	if(DEBUG) error_reporting(E_ALL ^ E_NOTICE);

	// for data connection
	$host = 'localhost';
	$dbname = 'nonviet';
	$dbuser = 'root';
	$dbpwd = 'susi';
/*	$host = 'localhost';
	$dbname = 'conicalh_nonviet';
	$dbuser = 'conicalh_cuong';
	$dbpwd = 'CuongNonViet!@';*/
	
	$rootPath = $DOCUMENT_ROOT."";
	define("pre_table", "nv_");
	define('const_Web_Url', 'http://'.$_SERVER['HTTP_HOST'].'/khachhang/nonviet/trunk/');
	define('const_Web_Path', $_SERVER['DOCUMENT_ROOT'].'/khachhang/nonviet/trunk/');
	define('const_Web_Log', $_SERVER['DOCUMENT_ROOT'].'/khachhang/nonviet/trunk/');
/*	define('const_Web_Url', 'http://'.$_SERVER['HTTP_HOST']);
	define('const_Web_Path', $_SERVER['DOCUMENT_ROOT']);
	define('const_Web_Log', $_SERVER['DOCUMENT_ROOT']);*/



	function connect($db_host_name, $db_user_name, $db_password, $db_name) {
		$dbconn = @mysql_pconnect($db_host_name, $db_user_name, $db_password);
		if ($dbconn)
		{
			if (@mysql_select_db($db_name, $dbconn)) return $dbconn;
			else show_error('Hien Dang Co Qua Nhieu Nguoi Truy Cap. Xin Cho it Phut!!: '.mysql_error());
		}
		else show_error('Hien Dang Co Qua Nhieu Nguoi Truy Cap. Xin Cho it Phut!!: '.mysql_error());
	}
	connect($host, $dbuser, $dbpwd, $dbname);
	
	function recordset($sql){
		$rs = mysql_query($sql) or show_error($sql);
		$row =  mysql_fetch_array($rs);	
		return $row;
	}
	function execSQL($sql){
		$rs = mysql_query($sql) or show_error($sql);
		return $rs;
	}
	
	function show_error($sql){
		error_log($sql."\n", 3, const_Web_Log."error_admin.txt");
		exit(); 
	}
	
?>	